generic
  type length_t is range<>;

package ariane.numerics.biginteger is

  -- object type is an indefinite private record
  type object(n : length_t) is private;

  -- array storing components of the numbers as its elements
  type cells_t is array(length_t range <>) of integer;

  type objectptr is access all object;

  -- creates a big integer object on stack
  function create(cells : cells_t) return object;

  -- creates a big integer object on heap with value given by the argument
  function create(o : object) return objectptr;

  -- destroys the big integer object created on heap
  procedure free(p : in out objectptr);

  -- gets the string represtentation of the big integer object
  function tostring(o : in object) return string;

  -- operators on big integer objects
  function "+"(lhs, rhs : in object) return object;
  function "-"(lhs, rhs : in object) return object;

private

  type cells_access is access all cells_t;

  -- each cell in the array accounts for certain portion of the number
  -- by representing corresponding digits in the number in decimal format
  -- and maximum of it is biggest possible multiple of 10 held by
  -- 32-bit integer minus one, i.e. 1000000000 - 1 = 999999999

  maxmulten : constant integer := 1000000000;
  maxcellval : constant integer := maxmulten - 1;
  maxdigitspercell : constant integer := 9;

  type object (n : length_t) is record
    -- array that store the data that represents the integer value
    cells : cells_t(1..n);
    actln : length_t;	-- effective length of the array
  end record;

end ariane.numerics.biginteger;
